package cn.com.callback;
import groovy.json.*;
import groovy.swing.impl.DefaultAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.RequestDispatcher;
import cn.com.elite.EliteBean;
import java.security.MessageDigest;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.wisdge.dataservice.Result;
import java.util.Map;
import java.util.Date;
import java.util.HashMap;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import cn.com.elite.Util;

/**
 * 
 * @Title: apiChatUpdate
 * @Description: 会话发生转接或者会议后，坐席信息更新
 * @author: LiJuntao
 * @date 2020-04-28 下午4:10:40
 *
 */

public class CallRMBApi implements ServiceBackInvoke{
	private static final Log log = LogFactory.getLog(CallRMBApi.class);
	public String doCallBack(EliteBean eliteBean, HttpServletRequest request, HttpServletResponse response) {

		response.setCharacterEncoding("UTF-8");
		response.setContentType("application/json;charset=utf-8");

		//获取调用参数
		String serviceId = request.getParameter("serviceid");
		String callType = request.getParameter("calltype");

		log.debug("CallRMBApi [serviceId]:" + serviceId + "  [callType]:" + callType);

		//接收客户端调用参数
		String callJson = "";
		InputStreamReader reader = new InputStreamReader(request.getInputStream(), "UTF-8");
		BufferedReader iny = new BufferedReader(reader);
		String line;
		while ((line = iny.readLine()) != null) {
			callJson += line;
		}

		log.info("[调用前置系统]:" + callJson);

		return "SUCC";
	}
}